<%@page import="systems.AdsSystem"%>
<%@page import="helpers.LanguageHelper"%>
<%@page import="entities.User"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="entities.SiteConfig"%>
<%
LanguageHelper translate = (LanguageHelper) request.getAttribute("translate");

String serverName = "articlestrump.com";

SiteConfig siteConfig = (SiteConfig) request.getAttribute("config");
String title = (String) request.getParameter("title");
String description = (String) request.getParameter("description");
String keywords = (String) request.getParameter("keywords");
String ogSiteName = (String) request.getParameter("ogsite_name");
String ogTitle = (String) request.getParameter("ogtitle"); 
String ogUrl = (String) request.getParameter("ogurl");
String ogImage = (String) request.getParameter("ogimage");
String ogDescription = (String) request.getParameter("ogdescription");

if (title == null && siteConfig != null)
	title = siteConfig.getTitle();

if (description == null && siteConfig != null)
	description = siteConfig.getMetaDescription();

if (keywords == null && siteConfig != null)
	keywords = siteConfig.getMetaKeywords();

if (ogSiteName == null && siteConfig != null)
	ogSiteName = siteConfig.getSiteName();

if (ogTitle == null && siteConfig != null)
	ogTitle = siteConfig.getTitle();

if (ogDescription == null && siteConfig != null)
	ogDescription = siteConfig.getMetaDescription();

if (ogUrl == null)
	ogUrl = UrlHelper.getServerUrl(request);

if (ogImage == null)
	ogImage = "http://immediatenet.com/t/t_a?Size=1024x768&URL=" + UrlHelper.getDomainServer(request);

User user = (User) request.getAttribute("user_logged_in");
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=<%=siteConfig.getHttpCharacterSet().toUpperCase()%>">
	<meta name="description" content="<%=description.replaceAll("[\"\']+", "")%>" >
	<meta name="Keywords" content="<%=keywords.replaceAll("[\"\']+", "")%>" >
	<meta itemprop="name" content="<%=ogTitle.replaceAll("[\"\']+", "")%>" />    
	<meta itemprop="description" content="<%=ogDescription %>" />
	<meta property="og:site_name" content="<%=ogSiteName %>" >
	<meta property="og:title" content="<%=ogTitle.replaceAll("[\"\']+", "")%>" >
	<meta property="og:url" content="<%=ogUrl%>" >
	<meta property="og:image" content="<%=ogImage%>" >
	<meta property="og:description" content="<%=ogDescription %>" >
	<title><%=title%></title>
	<link rel="stylesheet" type="text/css" href="/css/style.css" />
	<script src="/js/jquery-1.7.1.min.js"></script>
	<script src="/js/general.js"></script>

	<!--[if lte IE 8]>
	    <script src="/js/html5.js" type="text/javascript"></script>
		<body class="ie">
	<![endif]-->
</head>

<body>
	<div id="master">
    	<header>
        	<div class="headerTop clearafter">
            	<div id="logo" class="left">
                	<a href="/" id="logo"><img src="/images/logo.png" /></a>
                </div>
                <div class="loginArea right">
                	<% if (user == null) { %>
                    <a href="/login" class="google-login"><img src="/images/login_google.png" /></a>
                    <% } else { %>
                    <a href="/profile/edit"><%=translate.getString("user_edit")%></a>
                    <a href="/profile/articles"><%=translate.getString("user_articles")%></a>
                    <a href="/logout"><%=translate.getString("user_logout")%></a>
                    <% } %>
                </div>
            </div>
            <nav id="mainMenu">
            	<ul class="clearafter">
                	<li><a href="/"><%=translate.getString("home")%></a></li>
                    <li><a href="/archives"><%=translate.getString("archives")%></a></li>
                    <li><a href="/rewriter"><%=translate.getString("rewrite")%></a></li>
                    <li><a href="/submit-article"><%=translate.getString("submit_article")%></a></li>
                    <li><a href="/authors"><%=translate.getString("authors")%></a></li>
                    <li><a href="/contact"><%=translate.getString("contact")%></a></li>
                </ul>
            </nav>
        </header>
        <div class="content-center">
        	<%=AdsSystem.getAds728x90() %>
        </div>
		<section id="content">